<?php

namespace app\model;

//use support\Model;
use support\Db;
use Illuminate\Database\Eloquent\Model;

class WaUsersProvider
{
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'wa_users_provider';

    /**
     * The primary key associated with the table.
     *
     * @var string
     */
    protected $primaryKey = 'id';

    /**
     * Indicates if the model should be timestamped.
     *
     * @var bool
     */
    public $timestamps = false;

    public static function all()
    {
        $pageNum = 10;
        $list = Db::table('wa_users_supplier')
            ->select('*')
            ->paginate($pageNum);

        return json_encode($list);
    }

    public static function providerCount($start_time,$end_time)
    {

        $start_time = date('Y-m-d H:i:s', $start_time);
        $end_time = date('Y-m-d H:i:s', $end_time);
        $provider_count =Db::table('wa_users_supplier')
            ->select('*')
            ->whereBetween('created_at',[$start_time,$end_time])
            ->count(); // 用户数量
        return $provider_count;

    }

}